//
// Created by Administrator on 2021/9/16.
//

#include <stdio.h>
#include <stdbool.h>
#include "task1.h"

void task4(){
    initRandSeed();
    int remain_question = 10;
    int right = 0,wrong = 0;
    while(remain_question--) {
        int num1 = getRandNum();
        char op = getRandOp();
        int num2 = getRandNum();
        int answer = 0;
        switch (op) {
            case '+': {
                answer = num1 + num2;
                break;
            }
            case '-': {
                answer = num1 - num2;
                break;
            }
            case '*': {
                answer = num1 * num2;
                break;
            }
            case '/': {
                answer = num1 / num2;
                break;
            }
        }

        printf("%d %c %d = ?", num1, op, num2);
        int stu_answer;

        scanf("%d", &stu_answer);
        if (stu_answer == answer) {
            printf("Right!\n");
            ++right;
        } else {
            printf("Wrong! Try again!\n");
            ++wrong;
        }
    }
    printf("right:%d, wrong:%d -> score = %d\n",right,wrong,right*10);
};